Package-level declarations

Contains types such as NotEmptyList for manipulating collections.

Types

Link copied to clipboard
@Serializable(with = NotEmptyListSerializer::class)
@SinceKotoolsTypes(version = "4.0")
data class NotEmptyList<out E>

Representation of lists that contain at least one element of type E.

Link copied to clipboard
@Serializable(with = NotEmptyMapSerializer::class)
@SinceKotoolsTypes(version = "4.0")
data class NotEmptyMap<K, out V>

Representation of maps that contain at least one entry with a key of type K and a value of type V.

Link copied to clipboard
@Serializable(with = NotEmptySetSerializer::class)
@SinceKotoolsTypes(version = "4.0")
data class NotEmptySet<out E>

Representation of sets that contain at least one element of type E.

Functions

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> notEmptyListOf(head: E, vararg tail: E): NotEmptyList<E>

Creates a NotEmptyList starting with a head and containing all the elements of the optional tail.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <K, V> notEmptyMapOf(head: Pair<K, V>, vararg tail: Pair<K, V>): NotEmptyMap<K, V>

Creates a NotEmptyMap starting with a head and containing all the entries of the optional tail.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> notEmptySetOf(head: E, vararg tail: E): NotEmptySet<E>

Creates a NotEmptySet starting with a head and containing all the elements of the optional tail.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> Collection<E>.toNotEmptyList(): Result<NotEmptyList<E>>

Returns a NotEmptyList containing all the elements of this collection, or returns an IllegalArgumentException if this collection is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <K, V> Map<K, V>.toNotEmptyMap(): Result<NotEmptyMap<K, V>>

Returns a NotEmptyMap containing all the entries of this map, or returns an IllegalArgumentException if this map is empty.

Link copied to clipboard
@SinceKotoolsTypes(version = "4.0")
fun <E> Collection<E>.toNotEmptySet(): Result<NotEmptySet<E>>

Returns a NotEmptySet containing all the elements of this collection, or returns an IllegalArgumentException if this collection is empty.